package com.rlyy.rsj.utils;

/**
 *
 * CACHE 缓存
 * LOCK 分布式锁
 *
 * 系统|模块|key名称|keyIdentify
 *
 * @author yuanweijie
 */
public class RedisKeyFactory {

    /**
     * rsj 系统识别
     * %s 参数类别
     * %s userId 单一类别
     */
    private static final String keyTemplate = "rsj|%s|%s";

    public static String wrapLoginKey(String userId) {
        return "rsj|login|userId|" + userId;
    }

    public static String wrapSecret(String key){
        return "rsj|sign_secret_key|" + key;
    }

    public static String wrapJobKey(String key){
        return String.format(keyTemplate, "job", key);
    }

    public static String wrapRemindKey(String key){
        return String.format(keyTemplate, "remind", key);
    }

    public static void main(String[] args) {
        System.out.println(wrapJobKey("RedisKeyFactory"));
    }

}
